package com.knight.study.patterns.tujie.iterator;

import com.alibaba.fastjson.JSONObject;

/**
 * @Author knight
 * @Date 2024/9/5 16:16
 */

public class IteratorMain {
    public static void main(String[] args) {
        BookShelf bookShelf = new BookShelf(4);
        bookShelf.appendBook(new Book("123"));
        bookShelf.appendBook(new Book("456"));
        bookShelf.appendBook(new Book("459"));
        bookShelf.appendBook(new Book("4510"));

        final Iterator iterator = bookShelf.iterator();
        while (iterator.hasNext()) {
            final Book book = (Book) iterator.next();
            System.out.println(JSONObject.toJSONString(book));
        }

    }
}
